package com.cskaoyan.bean.wx_home_index;

import com.cskaoyan.bean.promotion.Poster;
import com.cskaoyan.util.DateUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: WD created on 2021-09-18 17:05
 * @Version:
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class InnerBanner {
    private Integer id;
    private String name;
    private String link;
    private String url;
    private Integer position;
    private String content;
    private Boolean enabled;
    private String addTime;
    private String updateTime;
    private Boolean deleted;


    public InnerBanner(Poster poster) {
        this.id = poster.getId();
        this.name = poster.getName();
        this.link = poster.getLink();
        this.url = poster.getUrl();
        this.position = poster.getPosition();
        this.content = poster.getContent();
        this.enabled = poster.getEnabled();
        if (poster.getAddTime() != null) {
            this.addTime = DateUtils.dateFormat(poster.getAddTime());
        }
        if (poster.getUpdateTime() != null) {
            this.updateTime = DateUtils.dateFormat(poster.getUpdateTime());
        }
        this.deleted = poster.getDeleted();


    }
}
